/**
 * Copyright (C) 2010 altuure <altuure [AT] gmail [DOT] com> http://www.altuure.com/projects/yagdao
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.altuure.yagdao.dao;

import com.altuure.yagdao.*;
import com.altuure.yagdao.model.SimpleBean;

import java.util.List;

/**
 * sample dao for test
 * @see SimpleBean
 */
public interface SimpleBeanAppendDAO extends GenericDAO<SimpleBean, Long> {

    /***
     * check if old version compatible    
     * @param arg1
     * @return
     */
    @YMethod(type = YMethodType.APPEND)
    SearchResultList<SimpleBean> append0(@YParameter("pbyte>=?") byte arg1,@YParameter("pbyte<=?") byte arg2);
    /**
     * Sample criteria builder
     * @param arg1 optional parameter 1
     * @return list of entities
     */
    @YMethod(type = YMethodType.APPEND,select = "pbyte")
    SearchResultList append1(@YParameter("pbyte>=?") byte arg1,@YParameter("pbyte<=?") byte arg2);

     @YMethod(type = YMethodType.APPEND,select = "pbyte,count(id)",groupBy = "pbyte")
    List<SimpleBean> append2(@YParameter("pint>=?") int i);

    @YMethod(type = YMethodType.APPEND,select = "pbyte,count(id)",groupBy = "pbyte",having = "count(id)>10")
    List<SimpleBean> append3(@YParameter("pint>=?") int i);

    @YMethod(type = YMethodType.APPEND)
    List<SimpleBean> append4_1(@YParameter("pstringNullable is null")YApply aTrue);

    @YMethod(type = YMethodType.APPEND)
    List<SimpleBean> append4_2(@YParameter(value="pstringNullable = ?",acceptNull = true)String  txt);

    @YMethod(type = YMethodType.APPEND,orderBy = "id desc")
    SearchResultList appendPage1(@YParameter("pbyte>=?") byte arg1,YLimit limit);


}
